package com.intelligentpension.kotlinbluetoothprint.printutils

import android.R
import android.content.Context
import java.text.SimpleDateFormat
import java.util.*
import kotlin.collections.ArrayList


/**
 * 版权：点赞 版权所有
 * author :赵航
 * @e-mail: zhaohangcn@gmail.com
 * time：2022/4/6
 * describe ：
 */
class PrintOrderDataMaker(var mContext: Context, var width: Int, var height: Int) {

    open fun getPrintData(): MutableList<ByteArray> {
        val data: ArrayList<ByteArray> = ArrayList()

        try {
            var printer = PrinterWriter(width, height)
            printer.setAlignCenter()
            data.add(printer.getDataAndReset())
//            val image1: ArrayList<ByteArray> =
//                printer.getImageByte(mContext.resources, R.mipmap.sym_def_app_icon)
//
//            data.addAll(image1)
//
            printer.setAlignLeft()
            printer.printLine()
            printer.lineFeed()
//
            printer.lineFeed()
            printer.setAlignCenter()
            printer.setEmphasizedOn()
            printer.setFontSize(1)
            printer.printText("体检报告")
            printer.lineFeed()
            printer.setEmphasizedOff()
            printer.lineFeed()

            printer.setFontSize(0)

            printer.printInOneLine("收缩压",  "123", 0)
            printer.lineFeed()
            printer.lineFeed()
            printer.printInOneLine("舒张压",  "123", 0)
            printer.lineFeed()
            printer.lineFeed()
            printer.printInOneLine("脉  搏",  "123", 0)
            printer.lineFeed()
            printer.lineFeed()
            printer.lineFeed()

            printer.printLine()
            printer.lineFeed()
            printer.lineFeed()
            printer.lineFeed()
            printer.lineFeed()
            printer.feedPaperCutPartial()
            data.add(printer.getDataAndClose())


        } catch (e: Exception) {
            e.printStackTrace()
        }


        return data;
    }
}